<template>
  <div>
    <div style=" text-align: center;">
      <h1>企业信息维护</h1>
    </div>
    <el-form class="demo-ruleForm" label-width="80px" :model="list">
      <el-form-item label="企业介绍">
        <el-input type="textarea" :rows="2" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="list.introduce">
        </el-input>
      </el-form-item>
      <el-form-item label="主营业务">
        <el-input type="textarea" :rows="2" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="list.mainDescription">
        </el-input>
      </el-form-item>
      <el-form-item label="数据业务">
        <el-input type="textarea" :rows="2" :autosize="{ minRows: 2, maxRows: 6}" placeholder="请输入内容" v-model="list.dataDescription">
        </el-input>
      </el-form-item>
      <el-form-item label="历史业绩">
        <!-- <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="list.performance">
        </el-input> -->
        <!-- 全局组件 -->
        <Editor v-model="list.performance" :height="200"></Editor>
      </el-form-item>
      <div class="email">
        <span>联系方式</span>
        <el-input class="input" placeholder="请输入联系方式" v-model="list.authPhone"></el-input>
        <span style="margin-left: 70px">邮箱</span>
        <el-input class="input" placeholder="请输入邮箱" v-model="list.email"></el-input>
      </div>
      <div class="button">
        <el-button type="primary" @click="tijiao(ruleForm)">提交</el-button>
      </div>
    </el-form>
  </div>
</template>

<script>
import { isPhoneNumber, isEmail, QiyeWeihu, HuoquQiyeWeihu } from '../api/api.js'
export default {
  data() {
    return {
      ruleForm: {},
      list: {
        id: '',
        //企业介绍
        introduce: '',
        //主营业务
        mainDescription: '',
        //数据业务
        dataDescription: '',
        //历史业绩
        performance: '',
        //企业地址
        businessAddress: '',
        //联系方式
        authPhone: '',
        //邮箱
        email: ''
      }
    }
  },

  methods: {
    tijiao() {
      if (isPhoneNumber(this.list.authPhone)) {
      } else {
        this.$message.error('请输入正确的手机号')
        return
      }
      if (isEmail(this.list.email)) {
      } else {
        this.$message.error('请输入正确的邮箱')
        return
      }
      QiyeWeihu(this.list)
        .then(res => {
          this.$message.success('提交成功')
          // console.log('企业维护111', res)
        })
        .catch(error => {
          // console.log(error);
        })
    },
    getList() {}
  },
  created() {},
  mounted() {
    HuoquQiyeWeihu().then(res => {
      this.list = res.data.data
      // console.log('企业维护信息', res.data.data)
    })
  }
}
</script>

<style lang="less" scoped>
.demo-ruleForm {
  margin: auto;
  align-content: center;
  justify-content: center;
}

.input {
  width: 40%;
  padding-left: 10px;
}

.button {
  display: flex;
  align-content: center;
  justify-content: center;
  margin-top: 20px;
}

.email {
  font-size: 14px;
  color: #606266;
  margin-left: 10px;
}
</style>